﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using SME.Food.Surperise.DBHelper;

namespace SME.Food.Surperise.Model
{
   public class TextAutoSuggestDal
    {
       public string GetNames(string ProjectName)
       {
           StringBuilder strSql = new StringBuilder();
           strSql.Append("SELECT  TOP(10) name FROM  TextAutoSuggest");
           strSql.Append(" where name  like '" + ProjectName + "%'");
           DataSet ds = DbHelper.Query(strSql.ToString());
           string returnText = "";
           if (ds.Tables[0].Rows.Count > 0)
           {
               for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
               {
                   returnText += ds.Tables[0].Rows[i]["name"].ToString() + "\n";
               }
               return returnText;
           }
           else
           {
               return null;
           }
       }
    }
}
